﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Bussiness;

namespace WebApplication.Admin
{
    public partial class HoaDonXuat : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                loadhd();
            }

        }
        void loadhd()
        {
            if (Session["datakh"] != null)
            {
                DataTable data = (DataTable)Session["datakh"];
                List<string> Lstmahd = new List<string>();
                string mhd = "";
                string tinhtrang = "";
                for (int i = 0; i <data.Rows.Count; i++)
                {
                    mhd = data.Rows[i]["mahd"].ToString();
                    Lstmahd.Add(mhd);
                    
                }
                tinhtrang = data.Rows[0]["tinhtrang"].ToString();
                string ngay=DateTime.Now.ToString("dd/MM/yyyy");
                if (Lstmahd.Count > 0)
                {
                    
                     var source = new Microsoft.Reporting.WebForms.ReportDataSource("HDX", new Baocao.HoaDonXuat().GetHDX(ngay, Lstmahd,tinhtrang));
                     ReportViewer1.LocalReport.ReportPath = @"Admin\Baocao\HoaDonXuat.rdlc";
                     ReportViewer1.LocalReport.DataSources.Clear();
                     ReportViewer1.LocalReport.DataSources.Add(source);
                     ReportViewer1.LocalReport.Refresh();
                }
            }
        }
    }
}